<?php ob_start();?>
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include($root.'/standart/head.php');
include($root.'/standart/dateHeader.php');
include($root.'/standart/checkUser.php');
	$username="";
	$pass="";
	$name="";
	$surname="";

if(isset($_COOKIE['GEVEZE_ADMIN'])){
	$db = connect();
	$adminId = $_COOKIE["GEVEZE_ADMIN"];
	$stmt ="SELECT *
	FROM ADMIN
	WHERE ID = $adminId";
	$res = $db->query($stmt) or die($stmt."<br/><br/>".mysql_error());
	$row = $res->fetch_assoc();
		$username= $row["USERNAME"];
		$name= $row["NAME"];
		$surname= $row["SURNAME"];
	$res->close();
	disconnect($db);
} 

?>

<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Geveze Cafe | Yönetici Ayarları</title>
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../font-awesome/css/font-awesome.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../css/jquery.cleditor.css" />
    <link href="../css/sb-admin.css" rel="stylesheet">
    <script type="text/javascript" src="../js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="../js/ajax.js"></script>
	<script type="text/javascript" src="../js/jquery.cleditor.min.js"></script>
  	<script type="text/javascript" src="../js/jquery.cleditor.table.min.js"></script>
  	<script
	src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"
	type="text/javascript"></script>

  	<script type="text/javascript">
    function sentdata(){
    	var formData = $('#submitform').serialize();
    	$.ajax( {url: "setfields.php",
    			type: "POST",
    			data:  formData,
    			contentType: "application/x-www-form-urlencoded; charset=UTF-8",
    			success: function(data, textStatus, jqXHR)
    			{
    				$( "#result" ).html( data );
    			}});
    }
  	</script>
  	

</head>

<body>
    <div id="wrapper">
		<div id="inner-page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Yönetici Ayarları</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
			<form id="submitform" role="form" action="setfields.php"
							method="post">
			<fieldset>
            <div class= "form-group">
            <label>Kullanıcı Adınız :</label>
            <input type="text" class="form-control" placeholder="<?php echo $username; ?>" name="username">
            </div>
            <div class= "form-group">
            <label>Şifreniz :</label>
            <input type="password" class="form-control" name="pass" placeholder="Değiştirmek için lütfen bu alanı doldurun!">
            </div>
            <div class= "form-group">
            <label>İsminiz :</label>
            <input type="text" class="form-control" placeholder="<?php echo $name; ?>" name="name">
            </div>
            <div class= "form-group">
            <label>Soyadınız :</label>
            <input type="text" class="form-control" placeholder="<?php echo $surname; ?>" name="surname">
            </div>
			<button type="button" onclick="sentdata()" class="btn btn-default">Kaydet</button>
			<b id="result" style="color:green;"></b>
            </div>
            </fieldset>
            </form>
        </div>
        <!-- /#page-wrapper -->
    </div>
    <!-- /#wrapper -->

    <!-- Core Scripts - Include with every page -->
    <script src="../js/jquery-1.10.2.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/plugins/metisMenu/jquery.metisMenu.js"></script>

    <!-- Page-Level Plugin Scripts - Blank -->

    <!-- SB Admin Scripts - Include with every page -->
    <script src="../js/sb-admin.js"></script>

    <!-- Page-Level Demo Scripts - Blank - Use for reference -->

</body>

</html>
<?php ob_end_flush(); ?>